#!/bin/bash

N=18
prefix_name="NDVI"
limit=50

folder_name=$prefix_name"_noised_"$N"pt"
g++ makenoise_calcdiff.cpp
if [ -d $folder_name ]; then
	new_folder_name=$folder_name"_backup"
	if [ -d $new_folder_name ]; then
		rm -r $new_folder_name
	fi
	mv $folder_name $new_folder_name
fi
mkdir $folder_name
for i in `seq 1 $limit`;
do
    file_name=$folder_name"_"$i".txt"
	./a.out > $file_name
	mv $file_name -t $folder_name/
	echo $file_name
    sleep 1
done
rm a.out
mv log_re.txt -t $folder_name
sublime-text $folder_name/log_re.txt